package leetcode15;

public class test83 {
    /**
     * 300. 最长递增子序列
     * @param nums
     * @return
     */
    public int lengthOfLIS(int[] nums) {
        int result = 0;
        int[] dp = new int[nums.length];
        for(int i = 0;i < dp.length;i++){
            dp[i] = 1;
        }
        for(int i = 1;i < nums.length;i++){
            for(int j = 0;j < i;j++){
                if(nums[i] > nums[j]){
                    dp[i] = Math.max(dp[i],dp[j] + 1);
                }
            }
        }
        for(int i = 0;i < dp.length;i++){
            result = Math.max(result,dp[i]);
        }
        return result;
    }
}
